package org.mc.api.user;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.mc.api.user.hystrix.UserQueryHystrixV1;
import org.mc.common.data.PagedDTO;
import org.mc.common.data.ResultData;
import org.mc.response.user.CustomerDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Api(value = "/UserQueryServiceV1", tags = "UserQueryServiceV1", description = "用户查询信息服务")
@FeignClient(value = "mc-user", fallback = UserQueryHystrixV1.class)
public interface UserQueryServiceV1 {

    @RequestMapping(value = "/v1/u/user/{userId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "通过用户id获取用户相关信息", notes = "通过用户id获取用户相关信息", httpMethod = "GET", tags = "UserQueryServiceV1")
    ResultData<CustomerDTO> queryCustomer(@ApiParam(value = "用户id", required = true) @PathVariable("userId") Long userId);

    @RequestMapping(value = "/v1/u/user/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "分页查询所以用户", notes = "分页查询所以用户", httpMethod = "GET", tags = "UserQueryServiceV1")
    ResultData<PagedDTO<List<CustomerDTO>>> listAll(@ApiParam(value = "这是当前页数")
                                                    @RequestParam(value = "pageIndex", defaultValue = "0") int pageIndex,
                                                    @ApiParam(value = "这是每页条数")
                                                    @RequestParam(value = "pageSize", defaultValue = "10") int pageSize);
}
